Surface MHCflurry's antigen-processing (cleavage) score (#235) - #240
Merged
Conversation
…#235) MHCflurry's Class1PresentationPredictor.predict() already returns a processing_score column (its antigen-processing / cleavage head) alongside presentation_score, and the wrapper's predict() read the latter while dropping the former. We were paying for the processing prediction on every run and never emitting it. Now emit it as a Kind.antigen_processing prediction. It depends only on the peptide + flanks (not the allele), so it's identical across a peptide's per-allele presentation rows -> emit one allele-less prediction per peptide, carrying the n_flank/c_flank context. Uses getattr(row, "processing_score", None) so older/newer mhcflurry builds without the column are a no-op. kind_support() advertises antigen_processing as mhc_dependence/mhc_class "none". No new dependency, no cost: the score was already computed. Also: * pred.py: add a PeptideResult.processing accessor for Kind.antigen_processing (the ProcessingPredictor already emits this kind; there was a `cleavage` accessor for proteasome_cleavage but none for antigen_processing). * annotate.py: add a `processing` output-field token -> (antigen_processing, score) so `predict-table` can pin the processing kind, e.g. `--predictor mhcflurry:proc:processing`. Tests: new test_mhcflurry_processing_score checks the emitted score matches MHCflurry's raw processing_score, is allele-less, and carries flanks; updates the multi-allele test for the extra prediction; adds an annotate-table test for the `processing` field token. Version 3.21.0 -> 3.22.0. Claude-Session: https://claude.ai/code/session_01LZahFhBSCiehXTESCYQ7wG
Two test gaps from the #240 review: * processing score is still emitted when no flanks are supplied (n_flank/ c_flank empty), not only in the flanked path; * the legacy predict_peptides / CLI (--output-csv) path stays affinity-only (one BindingPrediction per peptide/allele, no antigen_processing), so existing long-format consumers are unaffected by the new predict() output. Claude-Session: https://claude.ai/code/session_01LZahFhBSCiehXTESCYQ7wG
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #235.
MHCflurry's
Class1PresentationPredictor.predict()already returns aprocessing_scorecolumn (its antigen-processing / cleavage head) right next topresentation_score— and theMHCflurrywrapper readpresentation_score/presentation_percentilewhile discardingprocessing_score. We were computing the processing prediction on every run and throwing it away.Change
Emit it as a
Kind.antigen_processingprediction. It depends only on the peptide + flanks, not the allele (verified:SIINFEKL→0.96719for bothHLA-A*02:01andHLA-B*07:02), so it's emitted once per peptide, allele-less, carrying then_flank/c_flankcontext.getattr(row, "processing_score", None)guards older/newer mhcflurry builds without the column (no-op if absent).kind_support()advertisesantigen_processingasmhc_dependence/mhc_class="none", matching the other allele-free processing predictors.Small companions
PeptideResult.processingaccessor forKind.antigen_processing. The existingProcessingPredictoralready emits this kind, but there was acleavageaccessor forproteasome_cleavageand none forantigen_processing— filled the gap.predict-tableprocessingfield token →(antigen_processing, score), so the Add predict-table command to annotate CSVs with predictor scores (#231) #234 command can pin the processing kind:--predictor mhcflurry:proc:processing(avoids the kind-agnosticscoreambiguity when a predictor emits several kinds).Tests
test_mhcflurry_processing_score: asserts the emitted score matches MHCflurry's rawprocessing_score, is allele-less, carries the flanks, and thatkind_support()advertises it as allele-independent.test_mhcflurry_multiple_allelesfor the extra prediction (2 affinity + 1 presentation + 1 processing).test_processing_field_token_pins_antigen_processing_kindin the (binary-free) annotate-table suite.Compatibility
Additive by design. The new-API
predict(),predict_dataframe(), and protein-scanning gain one extraantigen_processingprediction/row per peptide forMHCflurry(filterable bykind). The legacypredict_peptidesand the CLI--output-csvpath is untouched — it stays affinity-only, oneBindingPredictionper (peptide, allele) — so existing long-format consumers see no change. Both are covered by regression tests (test_mhcflurry_legacy_predict_peptides_unchanged,test_mhcflurry_processing_score_without_flanks).Version
3.21.0 → 3.22.0.https://claude.ai/code/session_01LZahFhBSCiehXTESCYQ7wG